package com.eightgroups.tces.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.eightgroups.tces.entity.Dept;
import com.eightgroups.tces.entity.Teacher;
import com.eightgroups.tces.entity.TeacherVo;
import com.eightgroups.tces.mapper.DeptMapper;
import com.eightgroups.tces.mapper.TeacherMapper;
import com.eightgroups.tces.service.ITeacherService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 教师表 服务实现类
 * </p>
 *
 * @author zzc2016.cn
 * @since 2017-11-09
 */
@Service
public class TeacherServiceImpl extends ServiceImpl<TeacherMapper, Teacher> implements ITeacherService {

    @Autowired
    private TeacherMapper teacherMapper;
    @Override
    public Page<TeacherVo> selectByDept(Page<TeacherVo> page, EntityWrapper<TeacherVo> entityWrapper) {
        if(null != entityWrapper){
            entityWrapper.orderBy(page.getOrderByField(), page.isAsc());
        }
        page.setRecords(teacherMapper.selectByDept(page,entityWrapper));
        return page;
    }
}
